package com.visitor.shuangFenPai;

public class One {
        public static void main(String[] args) {
            Animal a = new Animal();
            Animal a1 = new Dog();
            Animal a2 = new Cat();

            Execute exe = new Execute();
            //execute重载了三次 ， 我要确定这个参数 a a1 a2
            // 到底是 animal 还是 cat 还是 dog ，也叫分派
            exe.execute(a);
            exe.execute(new Dog());
            exe.execute(a2);
        }
}

class Animal {
}

class Dog extends Animal {
}

class Cat extends Animal {
}

class Execute {
    public void execute(Animal a) {
        System.out.println("Animal");
    }

    public void execute(Dog d) {
        System.out.println("dog");
    }

    public void execute(Cat c) {
        System.out.println("cat");
    }
}
